home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / sndhrdw / pleiads.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  17KB  |  672 lines

  1. /****************************************************************************
  2.  *
  3.  * Sound hardware for Pleiades, Naughty Boy and Pop Flamer.
  4.  *
  5.  * If you find errors or have suggestions, please mail me.
  6.  * Juergen Buchmueller <pullmoll@t-online.de>
  7.  *
  8.  ****************************************************************************/
  9. #include "driver.h"
  10.  
  11. #define VMIN    0
  12. #define VMAX    32767
  13.  
  14. static int channel;
  15.  
  16. static int sound_latch_a;
  17. static int sound_latch_b;
  18. static int sound_latch_c;    /* part of the videoreg_w latch */
  19.  
  20. static UINT32 *poly18 = NULL;
  21. static int polybit;
  22.  
  23. /* fixed 8kHz clock */
  24. #define TONE1_CLOCK  8000
  25.  
  26. /* some resistor and capacitor dependent values which
  27.    vary between the (otherwise identical) boards. */
  28. static double pa5_charge_time;
  29. static double pa5_discharge_time;
  30.  
  31. static double pa6_charge_time;
  32. static double pa6_discharge_time;
  33.  
  34. static double pb4_charge_time;
  35. static double pb4_discharge_time;
  36.  
  37. static double pc4_charge_time;
  38. static double pc4_discharge_time;
  39.  
  40. static double pc5_charge_time;
  41. static double pc5_discharge_time;
  42.  
  43. static int pa5_resistor;
  44. static int pc5_resistor;
  45.  
  46. static int tone2_max_freq;
  47. static int tone3_max_freq;
  48. static int tone4_max_freq;
  49. static int noise_freq;
  50. static int polybit_resistor;
  51. static int opamp_resistor;
  52.  
  53. /*****************************************************************************
  54.  * Tone #1 is a fixed 8 kHz signal divided by 1 to 15.
  55.  *****************************************************************************/
  56. INLINE int tone1(int samplerate)
  57. {
  58.     static int counter, divisor, output;
  59.  
  60.     if( (sound_latch_a & 15) != 15 )
  61.     {
  62.         counter -= TONE1_CLOCK;
  63.         while( counter <= 0 )
  64.         {
  65.             counter += samplerate;
  66.             if( ++divisor == 16 )
  67.             {
  68.                 divisor = sound_latch_a & 15;
  69.                 output ^= 1;
  70.             }
  71.         }
  72.     }
  73.     return output ? VMAX : -VMAX;
  74. }
  75.  
  76. /*****************************************************************************
  77.  * Tones #2 and #3 are coming from the upper 556 chip
  78.  * It's labelled IC96 in Pop Flamer, 4D(??) in Naughty Boy.
  79.  * C68 controls the frequencies of tones #2 and #3 (V/C inputs)
  80.  *****************************************************************************/
  81. INLINE int update_pb4(int samplerate)
  82. {
  83.     static int counter, level;
  84.  
  85.     /* bit 4 of latch B: charge 10uF (C28/C68) through 10k (R19/R25) */
  86.     if( sound_latch_b & 0x10 )
  87.     {
  88.         if( level < VMAX )
  89.         {
  90.             counter -= (int)((VMAX - level) / pb4_charge_time);
  91.             if( counter <= 0 )
  92.             {
  93.                 int n = (-counter / samplerate) + 1;
  94.                 counter += n * samplerate;
  95.                 if( (level += n) > VMAX )
  96.                     level = VMAX;
  97.             }
  98.         }
  99.     }
  100.     else
  101.     {
  102.         if( level > VMIN )
  103.         {
  104.             counter -= (int)((level - VMIN) / pb4_discharge_time);
  105.             if( counter <= 0 )
  106.             {
  107.                 int n = (-counter / samplerate) + 1;
  108.                 counter += n * samplerate;
  109.                 if( (level -= n) < VMIN)
  110.                     level = VMIN;
  111.             }
  112.         }
  113.     }
  114.     return level;
  115. }
  116.  
  117. INLINE int tone23(int samplerate)
  118. {
  119.     static int counter2, output2, counter3, output3;
  120.     int level = VMAX - update_pb4(samplerate);
  121.     int sum = 0;
  122.  
  123.     /* bit 5 = low: tone23 disabled */
  124.     if( (sound_latch_b & 0x20) == 0 )
  125.         return sum;
  126.  
  127.     /* modulate timers from the upper 556 with the voltage on Cxx on PB4. */
  128.     if( level < VMAX )
  129.     {
  130.         counter2 -= tone2_max_freq * level / 32768;
  131.         if( counter2 <= 0 )
  132.         {
  133.             int n = (-counter2 / samplerate) + 1;
  134.             counter2 += n * samplerate;
  135.             output2 = (output2 + n) & 1;
  136.         }
  137.  
  138.         counter3 -= tone3_max_freq*1/3 + tone3_max_freq*2/3 * level / 33768;
  139.         if( counter3 <= 0 )
  140.         {
  141.             int n = (-counter2 / samplerate) + 1;
  142.             counter3 += samplerate;
  143.             output3 = (output3 + n) & 1;
  144.         }
  145.     }
  146.  
  147.     sum += (output2) ? VMAX : -VMAX;
  148.     sum += (output3) ? VMAX : -VMAX;
  149.  
  150.     return sum / 2;
  151. }
  152.  
  153. /*****************************************************************************
  154.  * Tone #4 comes from upper half of the lower 556 (IC98 in Pop Flamer)
  155.  * It's modulated by the voltage at C49, which is then divided between
  156.  * 0V or 5V, depending on the polynome output bit.
  157.  * The tone signal gates two signals (bits 5 of latches A and C), but
  158.  * these are also swept between two levels (C52 and C53 in Pop Flamer).
  159.  *****************************************************************************/
  160. INLINE int update_c_pc4(int samplerate)
  161. {
  162.     #define PC4_MIN (int)(VMAX * 7 / 50)
  163.  
  164.     static int counter, level = PC4_MIN;
  165.  
  166.     /* bit 4 of latch C: (part of videoreg_w) hi? */
  167.     if (sound_latch_c & 0x10)
  168.     {
  169.         if (level < VMAX)
  170.         {
  171.             counter -= (int)((VMAX - level) / pc4_charge_time);
  172.             if( counter <= 0 )
  173.             {
  174.                 int n = (-counter / samplerate) + 1;
  175.                 counter += n * samplerate;
  176.                 if( (level += n) > VMAX )
  177.                     level = VMAX;
  178.             }
  179.         }
  180.     }
  181.     else
  182.     {
  183.         if (level > PC4_MIN)
  184.         {
  185.             counter -= (int)((level - PC4_MIN) / pc4_discharge_time);
  186.             if( counter <= 0 )
  187.             {
  188.                 int n = (-counter / samplerate) + 1;
  189.                 counter += n * samplerate;
  190.                 if( (level -= n) < PC4_MIN )
  191.                     level = PC4_MIN;
  192.             }
  193.         }
  194.     }
  195.     return level;
  196. }
  197.  
  198. INLINE int update_c_pc5(int samplerate)
  199. {
  200.     static int counter, level;
  201.  
  202.     /* bit 5 of latch C: charge or discharge C52 */
  203.     if (sound_latch_c & 0x20)
  204.     {
  205.         if (level < VMAX)
  206.         {
  207.             counter -= (int)((VMAX - level) / pc5_charge_time);
  208.             if( counter <= 0 )
  209.             {
  210.                 int n = (-counter / samplerate) + 1;
  211.                 counter += n * samplerate;
  212.                 if( (level += n) > VMAX )
  213.                     level = VMAX;
  214.             }
  215.         }
  216.     }
  217.     else
  218.     {
  219.         if (level > VMIN)
  220.         {
  221.             counter -= (int)((level - VMIN) / pc5_discharge_time);
  222.             if( counter <= 0 )
  223.             {
  224.                 int n = (-counter / samplerate) + 1;
  225.                 counter += samplerate;
  226.                 if( (level -= n) < VMIN )
  227.                     level = VMIN;
  228.             }
  229.         }
  230.     }
  231.     return level;
  232. }
  233.  
  234. INLINE int update_c_pa5(int samplerate)
  235. {
  236.     static int counter, level;
  237.  
  238.     /* bit 5 of latch A: charge or discharge C63 */
  239.     if (sound_latch_a & 0x20)
  240.     {
  241.         if (level < VMAX)
  242.         {
  243.             counter -= (int)((VMAX - level) / pa5_charge_time);
  244.             if( counter <= 0 )
  245.             {
  246.                 int n = (-counter / samplerate) + 1;
  247.                 counter += n * samplerate;
  248.                 if( (level += n) > VMAX )
  249.                     level = VMAX;
  250.             }
  251.         }
  252.     }
  253.     else
  254.     {
  255.         if (level > VMIN)
  256.         {
  257.             counter -= (int)((level - VMIN) / pa5_discharge_time);
  258.             if( counter <= 0 )
  259.             {
  260.                 int n = (-counter / samplerate) + 1;
  261.                 counter += samplerate;
  262.                 if( (level -= n) < VMIN )
  263.                     level = VMIN;
  264.             }
  265.         }
  266.     }
  267.     return level;
  268. }
  269.  
  270. INLINE int tone4(int samplerate)
  271. {
  272.     static int counter, output;
  273.     int level = update_c_pc4(samplerate);
  274.     int vpc5 = update_c_pc5(samplerate);
  275.     int vpa5 = update_c_pa5(samplerate);
  276.     int sum;
  277.  
  278.     /* Two resistors divide the output voltage of the op-amp between
  279.      * polybit = 0: 0V and level: x * opamp_resistor / (opamp_resistor + polybit_resistor)
  280.      * polybit = 1: level and 5V: x * polybit_resistor / (opamp_resistor + polybit_resistor)
  281.      */
  282.     if (polybit)
  283.         level = level + (VMAX - level) * opamp_resistor / (opamp_resistor + polybit_resistor);
  284.     else
  285.         level = level * polybit_resistor / (opamp_resistor + polybit_resistor);
  286.  
  287.     counter -= tone4_max_freq * level / 32768;
  288.     if( counter <= 0 )
  289.     {
  290.         int n = (-counter / samplerate) + 1;
  291.         counter += n * samplerate;
  292.         output = (output + n) & 1;
  293.     }
  294.  
  295.     /* mix the two signals */
  296.     sum = vpc5 * pa5_resistor / (pa5_resistor + pc5_resistor) +
  297.           vpa5 * pc5_resistor / (pa5_resistor + pc5_resistor);
  298.  
  299.     return (output) ? sum : -sum;
  300. }
  301.  
  302. /*****************************************************************************
  303.  * Noise comes from a shift register (4006) hooked up just like in Phoenix.
  304.  * Difference: the clock frequecy is toggled between two values only by
  305.  * bit 4 of latch A. The output of the first shift register can be zapped(?)
  306.  * by some control line (IC87 in Pop Flamer: not yet implemented)
  307.  *****************************************************************************/
  308. INLINE int update_c_pa6(int samplerate)
  309. {
  310.     static int counter, level;
  311.  
  312.     /* bit 6 of latch A: charge or discharge C63 */
  313.     if (sound_latch_a & 0x40)
  314.     {
  315.         if (level < VMAX)
  316.         {
  317.             counter -= (int)((VMAX - level) / pa6_charge_time);
  318.             if( counter <= 0 )
  319.             {
  320.                 int n = (-counter / samplerate) + 1;
  321.                 counter += n * samplerate;
  322.                 if( (level += n) > VMAX )
  323.                     level = VMAX;
  324.             }
  325.         }
  326.     }
  327.     else
  328.     {
  329.         /* only discharge of poly bit is active */
  330.         if (polybit && level > VMIN)
  331.         {
  332.             /* discharge 10uF through 10k -> 0.1s */
  333.             counter -= (int)((level - VMIN) / 0.1);
  334.             if( counter <= 0 )
  335.             {
  336.                 int n = (-counter / samplerate) + 1;
  337.                 counter += n * samplerate;
  338.                 if( (level -= n) < VMIN )
  339.                     level = VMIN;
  340.             }
  341.         }
  342.     }
  343.     return level;
  344. }
  345.  
  346.  
  347. INLINE int noise(int samplerate)
  348. {
  349.     static int counter, polyoffs;
  350.     int c_pa6_level = update_c_pa6(samplerate);
  351.     int sum = 0;
  352.  
  353.     /*
  354.      * bit 4 of latch A: noise counter rate modulation?
  355.      * CV2 input of lower 556 is connected via 2k resistor
  356.      */
  357.     if ( sound_latch_a & 0x10 )
  358.         counter -= noise_freq * 2 / 3; /* ????? */
  359.     else
  360.         counter -= noise_freq * 1 / 3; /* ????? */
  361.  
  362.     if( counter <= 0 )
  363.     {
  364.         int n = (-counter / samplerate) + 1;
  365.         counter += n * samplerate;
  366.         polyoffs = (polyoffs + n) & 0x3ffff;
  367.         polybit = (poly18[polyoffs>>5] >> (polyoffs & 31)) & 1;
  368.     }
  369.  
  370.     /* The polynome output bit is used to gate bits 6 + 7 of
  371.      * sound latch A through the upper half of a 4066 chip.
  372.      * Bit 6 is sweeping a capacitor between 0V and 4.7V
  373.      * while bit 7 is connected directly to the 4066.
  374.      * Both outputs are then filtered, bit 7 even twice,
  375.      * but it's beyond me what the filters there are doing...
  376.      */
  377.     if (polybit)
  378.     {
  379.         sum += c_pa6_level;
  380.         /* bit 7 is connected directly */
  381.         if (sound_latch_a & 0x80)
  382.             sum += VMAX;
  383.     }
  384.     else
  385.     {
  386.         sum -= c_pa6_level;
  387.         /* bit 7 is connected directly */
  388.         if (sound_latch_a & 0x80)
  389.             sum -= VMAX;
  390.     }
  391.  
  392.     return sum / 2;
  393. }
  394.  
  395. static void pleiads_sound_update(int param, INT16 *buffer, int length)
  396. {
  397.     int rate = Machine->sample_rate;
  398.  
  399.     while( length-- > 0 )
  400.     {
  401.         int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate);
  402.         *buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767;
  403.     }
  404. }
  405.  
  406. WRITE_HANDLER( pleiads_sound_control_a_w )
  407. {
  408.     if (data == sound_latch_a)
  409.         return;
  410.  
  411.     logerror("pleiads_sound_control_b_w $%02x\n", data);
  412.  
  413.     stream_update(channel,0);
  414.     sound_latch_a = data;
  415. }
  416.  
  417. WRITE_HANDLER( pleiads_sound_control_b_w )
  418. {
  419.     /*
  420.      * pitch selects one of 4 possible clock inputs
  421.      * (actually 3, because IC2 and IC3 are tied together)
  422.      * write note value to TMS3615; voice b1 & b2
  423.      */
  424.     int note = data & 15;
  425.     int pitch = (data >> 6) & 3;
  426.  
  427.     if (data == sound_latch_b)
  428.         return;
  429.  
  430.     logerror("pleiads_sound_control_b_w $%02x\n", data);
  431.  
  432.     if (pitch == 3)
  433.         pitch = 2;    /* 2 and 3 are the same */
  434.  
  435.     tms36xx_note_w(0, pitch, note);
  436.  
  437.     stream_update(channel,0);
  438.     sound_latch_b = data;
  439. }
  440.  
  441. /* two bits (4 + 5) from the videoreg_w latch go here */
  442. WRITE_HANDLER( pleiads_sound_control_c_w )
  443. {
  444.     if (data == sound_latch_c)
  445.         return;
  446.  
  447.     logerror("pleiads_sound_control_c_w $%02x\n", data);
  448.     stream_update(channel,0);
  449.     sound_latch_c = data;
  450. }
  451.  
  452. static int common_sh_start(const struct MachineSound *msound, char *name)
  453. {
  454.     int i, j;
  455.     UINT32 shiftreg;
  456.  
  457.     poly18 = (UINT32 *)malloc((1ul << (18-5)) * sizeof(UINT32));
  458.  
  459.     if( !poly18 )
  460.         return 1;
  461.  
  462.     shiftreg = 0;
  463.     for( i = 0; i < (1ul << (18-5)); i++ )
  464.     {
  465.         UINT32 bits = 0;
  466.         for( j = 0; j < 32; j++ )
  467.         {
  468.             bits = (bits >> 1) | (shiftreg << 31);
  469.             if( ((shiftreg >> 16) & 1) == ((shiftreg >> 17) & 1) )
  470.                 shiftreg = (shiftreg << 1) | 1;
  471.             else
  472.                 shiftreg <<= 1;
  473.         }
  474.         poly18[i] = bits;
  475.     }
  476.  
  477.     channel = stream_init(name, 40, Machine->sample_rate, 0, pleiads_sound_update);
  478.     if( channel == -1 )
  479.         return 1;
  480.  
  481.     return 0;
  482. }
  483.  
  484. int pleiads_sh_start(const struct MachineSound *msound)
  485. {
  486.     /* The real values are _unknown_!
  487.      * I took the ones from Naughty Boy / Pop Flamer
  488.      */
  489.  
  490.     /* charge 10u?? (C??) through 330K?? (R??) -> 3.3s */
  491.     pa5_charge_time = 3.3;
  492.  
  493.     /* discharge 10u?? (C??) through 220k?? (R??) -> 2.2s */
  494.     pa5_discharge_time = 2.2;
  495.  
  496.     /* charge 2.2uF?? through 330?? -> 0.000726s */
  497.     pa6_charge_time = 0.000726;
  498.  
  499.     /* discharge 2.2uF?? through 10k?? -> 0.22s */
  500.     pa6_discharge_time = 0.022;
  501.  
  502.     /* 10k and 10uF */
  503.     pb4_charge_time = 0.1;
  504.     pb4_discharge_time = 0.1;
  505.  
  506.     /* charge C49 (22u?) via R47 (2k?) and R48 (1k)
  507.      * time constant (1000+2000) * 22e-6 = 0.066s */
  508.     pc4_charge_time = 0.066;
  509.  
  510.     /* discharge C49 (22u?) via R48 (1k) and diode D1
  511.      * time constant 1000 * 22e-6 = 0.022s */
  512.     pc4_discharge_time = 0.022;
  513.  
  514.     /* charge 10u?? through 330 -> 0.0033s */
  515.     pc5_charge_time = 0.0033;
  516.  
  517.     /* discharge 10u?? through ??k (R??) -> 0.1s */
  518.     pc5_discharge_time = 0.1;
  519.  
  520.     /* both in K */
  521.     pa5_resistor = 33;
  522.     pc5_resistor = 47;
  523.  
  524.     /* upper 556 upper half: Ra=10k??, Rb=200k??, C=0.01uF?? -> 351Hz */
  525.     tone2_max_freq = 351;
  526.  
  527.     /* upper 556 lower half: Ra=47k??, Rb=100k??, C=0.01uF?? -> 582Hz */
  528.     tone3_max_freq = 582;
  529.  
  530.     /* lower 556 upper half: Ra=33k??, Rb=100k??, C=0.0047uF??
  531.        freq = 1.44 / ((33000+2*100000) * 0.0047e-6) = approx. 1315 Hz */
  532.     tone4_max_freq = 1315;
  533.  
  534.     /* how to divide the V/C voltage for tone #4 */
  535.     polybit_resistor = 47;
  536.     opamp_resistor = 20;
  537.  
  538.     /* lower 556 lower half: Ra=100k??, Rb=1k??, C=0.01uF??
  539.       freq = 1.44 / ((100000+2*1000) * 0.01e-6) = approx. 1412 Hz */
  540.     noise_freq = 1412;    /* higher noise rate than popflame/naughtyb??? */
  541.  
  542.     return common_sh_start(msound, "Custom (Pleiads)");
  543. }
  544.  
  545. int naughtyb_sh_start(const struct MachineSound *msound)
  546. {
  547.     /* charge 10u??? through 330K (R??) -> 3.3s */
  548.     pa5_charge_time = 3.3;
  549.  
  550.     /* discharge 10u through 220k (R??) -> 2.1s */
  551.     pa5_discharge_time = 2.2;
  552.  
  553.     /* charge 2.2uF through 330 -> 0.000726s */
  554.     pa6_charge_time = 0.000726;
  555.  
  556.     /* discharge 2.2uF through 10K -> 0.022s */
  557.     pa6_discharge_time = 0.022;
  558.  
  559.     /* 10k and 10uF */
  560.     pb4_charge_time = 0.1;
  561.     pb4_discharge_time = 0.1;
  562.  
  563.     /* charge 10uF? (C??) via 3k?? (R??) and 2k?? (R28?)
  564.      * time constant (3000+2000) * 10e-6 = 0.05s */
  565.     pc4_charge_time = 0.05 * 10;
  566.  
  567.     /* discharge 10uF? (C??) via 2k?? R28??  and diode D?
  568.      * time constant 2000 * 10e-6 = 0.02s */
  569.     pc4_discharge_time = 0.02 * 10;
  570.  
  571.     /* charge 10u through 330 -> 0.0033s */
  572.     pc5_charge_time = 0.0033;
  573.  
  574.     /* discharge 10u through ??k (R??) -> 0.1s */
  575.     pc5_discharge_time = 0.1;
  576.  
  577.     /* both in K */
  578.     pa5_resistor = 100;
  579.     pc5_resistor = 78;
  580.  
  581.     /* upper 556 upper half: 10k, 200k, 0.01uF -> 351Hz */
  582.     tone2_max_freq = 351;
  583.  
  584.     /* upper 556 lower half: 47k, 200k, 0.01uF -> 322Hz */
  585.     tone3_max_freq = 322;
  586.  
  587.     /* lower 556 upper half: Ra=33k, Rb=100k, C=0.0047uF
  588.        freq = 1.44 / ((33000+2*100000) * 0.0047e-6) = approx. 1315 Hz */
  589.     tone4_max_freq = 1315;
  590.  
  591.     /* how to divide the V/C voltage for tone #4 */
  592.     polybit_resistor = 47;
  593.     opamp_resistor = 20;
  594.  
  595.     /* lower 556 lower half: Ra=200k, Rb=1k, C=0.01uF
  596.       freq = 1.44 / ((200000+2*1000) * 0.01e-6) = approx. 713 Hz */
  597.     noise_freq = 713;
  598.  
  599.     return common_sh_start(msound, "Custom (Naughty Boy)");
  600. }
  601.  
  602. int popflame_sh_start(const struct MachineSound *msound)
  603. {
  604.     /* charge 10u (C63 in Pop Flamer) through 330K -> 3.3s */
  605.     pa5_charge_time = 3.3;
  606.  
  607.     /* discharge 10u (C63 in Pop Flamer) through 220k -> 2.2s */
  608.     pa5_discharge_time = 2.2;
  609.  
  610.     /* charge 2.2uF through 330 -> 0.000726s */
  611.     pa6_charge_time = 0.000726;
  612.  
  613.     /* discharge 2.2uF through 10K -> 0.022s */
  614.     pa6_discharge_time = 0.022;
  615.  
  616.     /* 2k and 10uF */
  617.     pb4_charge_time = 0.02;
  618.     pb4_discharge_time = 0.02;
  619.  
  620.     /* charge 2.2uF (C49?) via R47 (100) and R48 (1k)
  621.      * time constant (100+1000) * 2.2e-6 = 0.00242 */
  622.     pc4_charge_time = 0.000242;
  623.  
  624.     /* discharge 2.2uF (C49?) via R48 (1k) and diode D1
  625.      * time constant 1000 * 22e-6 = 0.0022s */
  626.     pc4_discharge_time = 0.00022;
  627.  
  628.     /* charge 22u (C52 in Pop Flamer) through 10k -> 0.22s */
  629.     pc5_charge_time = 0.22;
  630.  
  631.     /* discharge 22u (C52 in Pop Flamer) through ??k (R??) -> 0.1s */
  632.     pc5_discharge_time = 0.1;
  633.  
  634.     /* both in K */
  635.     pa5_resistor = 33;
  636.     pc5_resistor = 47;
  637.  
  638.     /* upper 556 upper half: Ra=10k, Rb=100k, C=0.01uF -> 1309Hz */
  639.     tone2_max_freq = 1309;
  640.  
  641.     /* upper 556 lower half: Ra=10k??, Rb=120k??, C=0.01uF -> 1108Hz */
  642.     tone3_max_freq = 1108;
  643.  
  644.     /* lower 556 upper half: Ra=33k, Rb=100k, C=0.0047uF
  645.        freq = 1.44 / ((33000+2*100000) * 0.0047e-6) = approx. 1315 Hz */
  646.     tone4_max_freq = 1315;
  647.  
  648.     /* how to divide the V/C voltage for tone #4 */
  649.     polybit_resistor = 20;
  650.     opamp_resistor = 20;
  651.  
  652.     /* lower 556 lower half: Ra=200k, Rb=1k, C=0.01uF
  653.       freq = 1.44 / ((200000+2*1000) * 0.01e-6) = approx. 713 Hz */
  654.     noise_freq = 713;
  655.  
  656.     return common_sh_start(msound, "Custom (Pop Flamer)");
  657. }
  658.  
  659. void pleiads_sh_stop(void)
  660. {
  661.     if( poly18 )
  662.         free(poly18);
  663.     poly18 = NULL;
  664. }
  665.  
  666. void pleiads_sh_update(void)
  667. {
  668.     stream_update(channel, 0);
  669. }
  670.  
  671.  
  672.